<?php
/**
 * 站点配置管理
 * @author cjli
 *
 */
class SurveyAction extends AdminAction
{
	public function _initialize()
	{
		parent::_initialize();
	}
	public function survey_list(){
		$survey_db = D("survey");
		for($i=1;$i<=7;$i++){
			for($j=1;$j<=5;$j++){
				$sql = "SELECT COUNT(`question{$i}`) as num FROM `survey`  where question{$i} = {$j} GROUP BY `question{$i}` ";
				$num_array = $survey_db->query($sql);
				$survey_num[$i][$j]= $num_array[0];
			}
		}
		$this->assign('survey_num',$survey_num);
		$this->display('survey_list');
	}
	public function survey_form(){
		 $pageRows = 10;
		$survey_db = D("survey");
		$count = $survey_db->count();
		import("ORG.Util.Page");
		$Page = new Page($count,$pageRows);
		$pageShow = $Page->show();
		$survey_db->limit($Page->firstRow.','.$Page->listRows);
		$survey_info = $survey_db->order('time DESC')->select();
		$this->assign('survey_num',$survey_num);
		$this->assign('pageShow', $pageShow);
		$this->assign('survey_info',$survey_info);
		$this->display('survey_form');
	}
}